.class public Lcn/cheln/support/images/FileIconLoader;
.super Ljava/lang/Object;

# interfaces
.implements Landroid/os/Handler$Callback;


# static fields
.field private static final a:Ljava/util/concurrent/ConcurrentHashMap;


# instance fields
.field private final b:Ljava/util/concurrent/ConcurrentHashMap;

.field private final c:Landroid/os/Handler;

.field private d:Lcn/cheln/support/images/FileIconLoader$LoaderThread;

.field private e:Z

.field private final f:Landroid/content/Context;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    new-instance v0, Ljava/util/concurrent/ConcurrentHashMap;

    invoke-direct {v0}, Ljava/util/concurrent/ConcurrentHashMap;-><init>()V

    sput-object v0, Lcn/cheln/support/images/FileIconLoader;->a:Ljava/util/concurrent/ConcurrentHashMap;

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;)V
    .locals 1

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    new-instance v0, Ljava/util/concurrent/ConcurrentHashMap;

    invoke-direct {v0}, Ljava/util/concurrent/ConcurrentHashMap;-><init>()V

    iput-object v0, p0, Lcn/cheln/support/images/FileIconLoader;->b:Ljava/util/concurrent/ConcurrentHashMap;

    new-instance v0, Landroid/os/Handler;

    invoke-direct {v0, p0}, Landroid/os/Handler;-><init>(Landroid/os/Handler$Callback;)V

    iput-object v0, p0, Lcn/cheln/support/images/FileIconLoader;->c:Landroid/os/Handler;

    iput-object p1, p0, Lcn/cheln/support/images/FileIconLoader;->f:Landroid/content/Context;

    return-void
.end method

.method public static a(Ljava/lang/String;)Ljava/lang/String;
    .locals 4

    const-string v3, "/"

    invoke-virtual {p0}, Ljava/lang/String;->length()I

    move-result v0

    const/16 v1, 0xf9

    if-le v0, v1, :cond_0

    invoke-virtual {p0}, Ljava/lang/String;->length()I

    move-result v0

    const/16 v1, 0xff

    sub-int/2addr v0, v1

    add-int/lit8 v0, v0, 0x6

    invoke-virtual {p0, v0}, Ljava/lang/String;->substring(I)Ljava/lang/String;

    move-result-object v0

    :goto_0
    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    sget-object v2, Lcn/cheln/explorer/config/Constants;->b:Ljava/lang/String;

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, "/"

    invoke-virtual {v1, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, "/"

    const-string v2, "#"

    invoke-virtual {v0, v3, v2}, Ljava/lang/String;->replaceAll(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, ".thumb"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0

    :cond_0
    move-object v0, p0

    goto :goto_0
.end method

.method static synthetic a()Ljava/util/concurrent/ConcurrentHashMap;
    .locals 1

    sget-object v0, Lcn/cheln/support/images/FileIconLoader;->a:Ljava/util/concurrent/ConcurrentHashMap;

    return-object v0
.end method

.method static synthetic a(Lcn/cheln/support/images/FileIconLoader;)Ljava/util/concurrent/ConcurrentHashMap;
    .locals 1

    iget-object v0, p0, Lcn/cheln/support/images/FileIconLoader;->b:Ljava/util/concurrent/ConcurrentHashMap;

    return-object v0
.end method

.method static synthetic b(Lcn/cheln/support/images/FileIconLoader;)Landroid/content/Context;
    .locals 1

    iget-object v0, p0, Lcn/cheln/support/images/FileIconLoader;->f:Landroid/content/Context;

    return-object v0
.end method

.method private b()V
    .locals 2

    const/4 v1, 0x1

    iget-boolean v0, p0, Lcn/cheln/support/images/FileIconLoader;->e:Z

    if-nez v0, :cond_0

    iput-boolean v1, p0, Lcn/cheln/support/images/FileIconLoader;->e:Z

    iget-object v0, p0, Lcn/cheln/support/images/FileIconLoader;->c:Landroid/os/Handler;

    invoke-virtual {v0, v1}, Landroid/os/Handler;->sendEmptyMessage(I)Z

    :cond_0
    return-void
.end method

.method private static b(Landroid/widget/ImageView;Ljava/lang/String;Lcn/cheln/support/images/f;)Z
    .locals 5

    const/4 v4, 0x1

    const/4 v3, 0x0

    sget-object v0, Lcn/cheln/support/images/FileIconLoader;->a:Ljava/util/concurrent/ConcurrentHashMap;

    invoke-virtual {v0, p1}, Ljava/util/concurrent/ConcurrentHashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcn/cheln/support/images/e;

    if-nez v0, :cond_2

    const/4 v0, 0x0

    sget-object v1, Lcn/cheln/support/images/c;->a:[I

    iget-object v2, p2, Lcn/cheln/support/images/f;->b:Lcn/cheln/support/images/FileCategoryHelper$FileCategory;

    invoke-virtual {v2}, Lcn/cheln/support/images/FileCategoryHelper$FileCategory;->ordinal()I

    move-result v2

    aget v1, v1, v2

    packed-switch v1, :pswitch_data_0

    :goto_0
    if-nez v0, :cond_0

    move v0, v3

    :goto_1
    return v0

    :pswitch_0
    new-instance v0, Lcn/cheln/support/images/d;

    invoke-direct {v0, v3}, Lcn/cheln/support/images/d;-><init>(B)V

    iput-object p2, v0, Lcn/cheln/support/images/d;->a:Lcn/cheln/support/images/f;

    goto :goto_0

    :cond_0
    sget-object v1, Lcn/cheln/support/images/FileIconLoader;->a:Ljava/util/concurrent/ConcurrentHashMap;

    invoke-virtual {v1, p1, v0}, Ljava/util/concurrent/ConcurrentHashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    :cond_1
    iput v3, v0, Lcn/cheln/support/images/e;->b:I

    move v0, v3

    goto :goto_1

    :cond_2
    iget v1, v0, Lcn/cheln/support/images/e;->b:I

    const/4 v2, 0x2

    if-ne v1, v2, :cond_1

    invoke-virtual {v0}, Lcn/cheln/support/images/e;->a()Z

    move-result v1

    if-eqz v1, :cond_3

    move v0, v4

    goto :goto_1

    :cond_3
    invoke-virtual {v0, p0}, Lcn/cheln/support/images/e;->a(Landroid/widget/ImageView;)Z

    move-result v1

    if-eqz v1, :cond_1

    move v0, v4

    goto :goto_1

    :pswitch_data_0
    .packed-switch 0x1
        :pswitch_0
        :pswitch_0
        :pswitch_0
        :pswitch_0
    .end packed-switch
.end method

.method static synthetic c(Lcn/cheln/support/images/FileIconLoader;)Landroid/os/Handler;
    .locals 1

    iget-object v0, p0, Lcn/cheln/support/images/FileIconLoader;->c:Landroid/os/Handler;

    return-object v0
.end method


# virtual methods
.method public final a(Landroid/widget/ImageView;)V
    .locals 1

    iget-object v0, p0, Lcn/cheln/support/images/FileIconLoader;->b:Ljava/util/concurrent/ConcurrentHashMap;

    invoke-virtual {v0, p1}, Ljava/util/concurrent/ConcurrentHashMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;

    return-void
.end method

.method public final a(Landroid/widget/ImageView;Ljava/lang/String;Lcn/cheln/support/images/f;)Z
    .locals 3

    invoke-static {p1, p2, p3}, Lcn/cheln/support/images/FileIconLoader;->b(Landroid/widget/ImageView;Ljava/lang/String;Lcn/cheln/support/images/f;)Z

    move-result v0

    if-eqz v0, :cond_0

    iget-object v1, p0, Lcn/cheln/support/images/FileIconLoader;->b:Ljava/util/concurrent/ConcurrentHashMap;

    invoke-virtual {v1, p1}, Ljava/util/concurrent/ConcurrentHashMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;

    :goto_0
    return v0

    :cond_0
    new-instance v1, Lcn/cheln/support/images/FileIconLoader$FileId;

    invoke-direct {v1, p2, p3}, Lcn/cheln/support/images/FileIconLoader$FileId;-><init>(Ljava/lang/String;Lcn/cheln/support/images/f;)V

    iget-object v2, p0, Lcn/cheln/support/images/FileIconLoader;->b:Ljava/util/concurrent/ConcurrentHashMap;

    invoke-virtual {v2, p1, v1}, Ljava/util/concurrent/ConcurrentHashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    invoke-direct {p0}, Lcn/cheln/support/images/FileIconLoader;->b()V

    goto :goto_0
.end method

.method public handleMessage(Landroid/os/Message;)Z
    .locals 5

    const/4 v4, 0x1

    const/4 v1, 0x0

    iget v0, p1, Landroid/os/Message;->what:I

    packed-switch v0, :pswitch_data_0

    move v0, v1

    :goto_0
    return v0

    :pswitch_0
    iput-boolean v1, p0, Lcn/cheln/support/images/FileIconLoader;->e:Z

    iget-object v0, p0, Lcn/cheln/support/images/FileIconLoader;->d:Lcn/cheln/support/images/FileIconLoader$LoaderThread;

    if-nez v0, :cond_0

    new-instance v0, Lcn/cheln/support/images/FileIconLoader$LoaderThread;

    invoke-direct {v0, p0}, Lcn/cheln/support/images/FileIconLoader$LoaderThread;-><init>(Lcn/cheln/support/images/FileIconLoader;)V

    iput-object v0, p0, Lcn/cheln/support/images/FileIconLoader;->d:Lcn/cheln/support/images/FileIconLoader$LoaderThread;

    iget-object v0, p0, Lcn/cheln/support/images/FileIconLoader;->d:Lcn/cheln/support/images/FileIconLoader$LoaderThread;

    invoke-virtual {v0}, Lcn/cheln/support/images/FileIconLoader$LoaderThread;->start()V

    :cond_0
    iget-object v0, p0, Lcn/cheln/support/images/FileIconLoader;->d:Lcn/cheln/support/images/FileIconLoader$LoaderThread;

    invoke-virtual {v0}, Lcn/cheln/support/images/FileIconLoader$LoaderThread;->a()V

    move v0, v4

    goto :goto_0

    :pswitch_1
    iget-object v0, p0, Lcn/cheln/support/images/FileIconLoader;->b:Ljava/util/concurrent/ConcurrentHashMap;

    invoke-virtual {v0}, Ljava/util/concurrent/ConcurrentHashMap;->keySet()Ljava/util/Set;

    move-result-object v0

    invoke-interface {v0}, Ljava/util/Set;->iterator()Ljava/util/Iterator;

    move-result-object v2

    :cond_1
    :goto_1
    invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_2

    invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/widget/ImageView;

    iget-object v1, p0, Lcn/cheln/support/images/FileIconLoader;->b:Ljava/util/concurrent/ConcurrentHashMap;

    invoke-virtual {v1, v0}, Ljava/util/concurrent/ConcurrentHashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcn/cheln/support/images/FileIconLoader$FileId;

    iget-object v3, v1, Lcn/cheln/support/images/FileIconLoader$FileId;->a:Ljava/lang/String;

    iget-object v1, v1, Lcn/cheln/support/images/FileIconLoader$FileId;->b:Lcn/cheln/support/images/f;

    invoke-static {v0, v3, v1}, Lcn/cheln/support/images/FileIconLoader;->b(Landroid/widget/ImageView;Ljava/lang/String;Lcn/cheln/support/images/f;)Z

    move-result v0

    if-eqz v0, :cond_1

    invoke-interface {v2}, Ljava/util/Iterator;->remove()V

    goto :goto_1

    :cond_2
    iget-object v0, p0, Lcn/cheln/support/images/FileIconLoader;->b:Ljava/util/concurrent/ConcurrentHashMap;

    invoke-virtual {v0}, Ljava/util/concurrent/ConcurrentHashMap;->isEmpty()Z

    move-result v0

    if-nez v0, :cond_3

    invoke-direct {p0}, Lcn/cheln/support/images/FileIconLoader;->b()V

    :cond_3
    move v0, v4

    goto :goto_0

    nop

    :pswitch_data_0
    .packed-switch 0x1
        :pswitch_0
        :pswitch_1
    .end packed-switch
.end method
